import { request } from "../../utils/request.js";
import regeneratorRuntime, { values } from "../../utils/runtime.js";
var bsurl = require('../../utils/bsurl.js');
Component({
  properties: {
  },
  data: {
    Playlists:[],
    playlistCat:'华语',
    pagesize:20
  },
  methods: {
    async getplaylist(){
      let {pagesize}=this.data
      let playlistInfo=await request({url: bsurl+'top/playlist?order=hot&cat=华语&limit='+pagesize});
      let playlist=playlistInfo.playlists.map(v=>{
        return{
          name:v.name,
          coverImgUrl:v.coverImgUrl,
          id:v.id
        }
      })
      let playlistCat=playlistInfo.cat;
      this.setData({
        playlist:[...this.data.Playlists,...playlist],
        playlistCat
      })
    },
    hanlegetplaylist(){
      this.data.pagesize+=20
      this.getplaylist();
    }
  },
  lifetimes: {
    created() {
      this.getplaylist();
    },
  }
})
